Chris Pollett > Old Classes > CS174
( Print View )

Student Corner:
  [Submit Sec1]
  [Grades Sec1]

  [
Lecture Notes]
  [Discussion Board]

Course Info:
  [Texts & Links]
  [Description]
  [Course Outcomes]
  [Outcomes Matrix]
  [Course Schedule]
  [Grading]
  [Requirements/HW/Quizzes]
  [Class Protocols]
  [Exam Info]
  [Regrades]
  [University Policies]
  [Announcements]

HW Assignments:
  [Hw1]  [Hw2]  [Hw3]
  [Hw4]  [Hw5]  [Quizzes]

Practice Exams:
  [Midterm]  [Final]

                           












HW#2 --- last modified February 06 2019 04:04:57..

Solution set.

Due date: Mar 6

Files to be submitted:
  Hw2.zip

Purpose: To write a server-side application using PHP.

Related Course Outcomes:

The main course outcomes covered by this assignment are:

CLO1 -- Write HTML documents containing standard HTML elements including forms, tables, client-side scripts, and server-side scripts.

CLO3 -- Write server-side scripts that process HTML forms.

Specification:

For this homework, I want you to write a simple web text file editor. Below are some mock-ups of screens for this program.

Simple Text Editor

My Files

FilenameActions
A great story
Untitled
Dog Essay
Landing Page

Simple Text Editor

Edit: A great story

Edit Page

Simple Text Editor

Read: A great story

Once upon a time, there lived a little old man...
Edit Page

Simple Text Editor

Are you sure you want to delete the file: Untitled ?

Confirm Delete Page
Here are the requirements for your project:
  1. Your Hw2.zip folder should have a readme.txt file with all the names and ids for your group.
  2. All pages produced by your app should be valid XHTML 5.
  3. Your app should work regardless of what folder under DOCUMENT_ROOT the grader chooses to grade it. If you have variables/constants that need to be set to ensure this, they should be in a file config.php which is require_once'd by your index.php file.
  4. All urls used by your app (for links, form data, etc) should be of one of the following forms:
    (1) index.php
    (2) index.php?a=some_activity&arg1=some_argument1
    (3) index.php?a=some_activity&arg1=some_argument1&arg2=some_argument2
    Here allowed activities are: landing, edit, read, confirm. An example possible use of the arg1 variable might be to hold a file title.
  5. Your index.php should have four functions: landingView, editView, readView, confirmView. These are supposed to draw the Landing Page, The Edit Page, the Read Page, and the Confirm Page respectively, according to the mock-ups shown above. The only HTML that is output by your code, must be output in one of these four methods.
  6. The h1 tag with Simple Text Editor in it on all pages should link back to the landing page.
  7. On the landing page, the input text field should have Text File Name as a placeholder attribute.
  8. On the landing page, if a user enters a file name which is empty, only white space characters, or has characters which are non-alpha numeric or space, then clicking create will take on back to the landing page.
  9. On the landing page, if a user enters a non-empty, file name which consists of alphanumeric and space characters, they should be taken to the edit page, and the file name should appear in the h2 tag next to the words Edit:
  10. Similarly, if a user clicks the edit button next to an existing file name they should be taken to the edit page. In this case, text from a previous edit session should be loaded.
  11. Clicking the save button on the Edit Page should save the text in the textarea into the text_files subfolder of your web application's folder. The file name should be the file name that was given on the landing page followed by .txt. For example, the above Edit page would save to "A great story.txt".
  12. The Return button on the Edit Page should just go to the landing page without saving the document.
  13. If a user click on a link under my files, the user should go to a Read Page where the name of the file clicked should appear after Read in an h2 tag. Beneath this in a div tag should appear the contents of the file.
  14. If a Delete button on the Landing Page is clicked, the user should be taken to a Confirm Delete Page. This should have the text as in the mock-up above except that the name of the file should correspond to the Delete button clicked.
  15. Clicking Confirm on a Delete Page should delete the corresponding file and return the user to the Landing Page.
  16. Clicking Cancel on a Delete Page should return the user to the Landing Page without deleting the file.

Point Breakdown

Items (b)-(e) are each worth up 1pt 4pts
Items (a), (f)-(p) are each worth a 1/2pt 6pts
Total10pts